package com.example.springbootrabbitmq.utils;

import com.alibaba.fastjson.JSON;
import com.example.springbootrabbitmq.entity.TOrder;

public class FastJsonConverUtil {
    public static String objToJson(Object obj){
        try {
            String json = JSON.toJSONString(obj);
            return json;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }

    public static TOrder jsonToObj(String json){
        try {
            TOrder obj = JSON.parseObject(json,TOrder.class);
            return obj;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
}
